Sequence Diagram for the Car Rental System
Create a sequence diagram for online vehicle reservation in the car rental system and solve a challenge.
We'll cover the following
Sequence diagrams are a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for our car rental system. For the sake of this lesson, we will create sequence diagrams for the following two interactions:
Vehicle reservation: The member reserves a vehicle.
Sequence challenge: The member cancels their reservation.
Vehicle reservation#
The sequence diagram for vehicle reservation should have the following actors and objects that will interact with each other:
Actor:
Member
Objects:
Catalog
,Reservation
, andPayment
System
Here are the steps in the reserve vehicle interaction:
The member searches for a vehicle.
If the vehicle is available:
The catalog returns a list of available vehicles.
The member selects a vehicle to reserve.
The system creates a reservation against the vehicle.
The reservation fee is sent to the system.
The system requests payment from the member.
The member initiates payment against the reservation fee.
The payment is processed.
If the payment is successful:
The system is informed that the payment is completed.
The system updates the reservation status to “confirmed”.
The member is informed that the vehicle is reserved.
Else if the payment is unsuccessful:
The system is informed that the payment has failed.
The system deleted the reservation.
The system informs the member that the reservation is unsuccessful.
Else, if the vehicle is unavailable:
Members are notified that no vehicles are available.
Based on the order above, the sequence diagram of a vehicle reservation in a car rental system is provided below:
Sequence challenge: Cancel reservation#
You’ll help us complete a sequence diagram for a reservation canceled by the member. A skeleton of the cancel reservation sequence diagram is given below:
Notice that the arrows in the diagram above are numbered from 1 to 9. The message boxes shown below are the messages to be exchanged between the actor(s) and object(s). Can you rearrange the messages below in the correct sequence of order they should appear in the skeleton of the sequence diagram given above?
Note: If you get stuck, just click the “Show Solution” button to check the correct answer.
Alternatively, you can also click the "Show complete diagram" button below to view the complete sequence diagram of the cancel reservation interaction.
Next, let’s look at the activity diagrams for the car rental system to understand the control flow of the system.
Class Diagram for the Car Rental System
Activity Diagram for the Car Rental System